﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeGen.TS.Generation
{
    public static class ICodeGeneratorExtensions
    {
        public static void CopyTo(this ICodeGenerator from, ICodeGenerator target, bool withType=false)
        {
            if (withType)
            {
                target.ModulName = from.ModulName;
                target.NewTypeName = from.NewTypeName;
                target.Type = from.Type;
                
            }
            target.BaseTypeMode = from.BaseTypeMode;
            target.OutputFileName = from.OutputFileName;
            target.UseObservable = from.UseObservable;

            target.RecursionLevel = from.RecursionLevel;
        }
        public static void CopyToDependend(this ICodeGenerator from, ICodeGenerator target, bool withType = false)
        {
            CopyTo(from, target, withType);
            if (target.RecursionLevel != -1 && target.RecursionLevel != int.MinValue && target.RecursionLevel!=0)
            {
                target.RecursionLevel -= 1;
            }
        }
    }
}
